Pausing a JTextField
Unfortunately you cant use sleep in JTextField, you have to use a convulated method below:
textField.setText("happy");
ActionListener listener = new ActionListener(){
public void actionPerformed(ActionEvent event){
//put all you want to do after delay in here
textField.setText("dog");
}
};
Timer displayTimer = new Timer(2000, listener);
displayTimer.start();
displayTimer.setRepeats(false);
|